package org.liquidByte.simpleChat.dto;

import java.io.Serializable;

public class UserIdentification implements Serializable {
	private static final long serialVersionUID = -779043184410392470L;
	private static int seed = 0;	
	private synchronized static int getNextId() {
		return UserIdentification.seed++;
	}
	
	private int id;
	
	public UserIdentification() {
		this.id = UserIdentification.getNextId();
	}

	public int getId() {
		return id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserIdentification other = (UserIdentification) obj;
		if (id != other.id)
			return false;
		return true;
	}	
}
